" vim: fdm=marker
let s:current_file_path = expand('<sfile>')
let g:vimfiles = fnamemodify(s:current_file_path, ':p:h:h')
" 
" " Ale:{{{
" let g:ale_c_clangd_executable = 'clangd'
" let g:ale_c_clangd_options = '--check=acos.c'
" let g:ale_change_sign_column_color = get(g:, 'ale_change_sign_column_color', 1)
" let g:ale_close_preview_on_insert = get(g:, 'ale_close_preview_on_insert', 1)
" let g:ale_completion_enabled = get(g:, 'ale_completion_enabled', 1)
" let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100)
" let g:ale_cursor_detail  = get(g:, 'ale_cursor_detail', 1)
" let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
" let g:ale_detail_to_floating_preview = get(g:, 'ale_detail_to_floating_preview', 1) 
" let g:ale_disable_lsp = get(g:, 'ale_disable_lsp', 0)
" let g:ale_echo_cursor = get(g:, 'ale_echo_cursor', 1)
" let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10)
" let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error')
" let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info')
" let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning')
" let g:ale_echo_msg_log_str = get(g:, 'ale_echo_msg_log_str', 'Log')
" let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
" let g:ale_exclude_highlights = get(g:, 'ale_exclude_highlights', ['line too long', ''])
" let g:ale_fixers = { 'python': ['autopep8'], 'html': [], '*': []}
" let g:ale_fix_on_save = get(g:, 'ale_fix_on_save', 0)
" let g:ale_fix_on_save_ignore = get(g:, 'ale_fix_on_save_ignore', {})
" let g:ale_history_enabled = get(g:, 'ale_history_enabled', 1)
" let g:ale_hover_cursor = get(g:, 'ale_hover_cursor', 1)
" let g:ale_hover_to_preview = get(g:, 'ale_hover_to_preview', 1)
" let g:ale_hover_to_floating_preview = get(g:, 'ale_hover_to_floating_preview', 0)
" let g:ale_floating_preview = get(g:, 'ale_floating_preview', 0)
" let g:ale_floating_window_border = get(g:, 'ale_floating_window_border', ['│', '─', '╭', '╮', '╯', '╰', '│', '─'])
" let g:ale_lint_on_save = get(g:, 'ale_fix_on_save', 1)
" let g:ale_linters = get(g:, 'ale_linters', {'c++': ['clangd'], 'python': ['pylint']})
" let g:ale_matlab_mlint_executable = executable('mlint') ? 'mlint' : 'C:\Programs\MATLAB\R2020b\bin\win64\mlint.exe' 
" let g:ale_popup_menu_enabled = get(g:, 'ale_popup_menu_enabled', 1)
" let g:ale_python_pyright_executable =  get(g:, 'ale_python_pyright_executable', 'pyright-langserver')
" let g:ale_python_pyright_config =  get(g:, 'ale_python_pyright_config', { 'python': {'pythonPath': exepath('python') } })
" let g:ale_root = get(g:, 'ale_root', {})
" let g:ale_set_balloons = get(g:, 'ale_set_balloons', 1)
" let g:ale_sign_error = get(g:, 'ale_sign_error', '✗')
" let g:ale_sign_warning = get(g:, 'ale_sign_warning', '⚡')
" let g:ale_windows_node_executable_path = get(g:, 'ale_windows_node_executable_path', exepath('node.exe'))
" 
" function! SmartInsertCompletion() abort
"     " Use the default CTRL-N in completion menus
"     if pumvisible()
"         return "\<C-n>"
"     endif
"     " Exit and re-enter insert mode, and use insert completion
"     return "\<C-c>a\<C-n>"
" endfunction
" inoremap <silent> <C-n> <C-R>=SmartInsertCompletion()<CR>
" let g:leader_keymap = get(g:, 'leader_keymap', {})
" let g:leader_keymap.a = get(g:leader_keymap, 'a', { '+name': 'ale', 
"             \   'a': ['<Plug>(ale_code_action)', 'action'],
"             \   'c': ['<Plug>(ale_complete)', 'completion'],
"             \   'd': ['<Plug>(ale_documentation)', 'document'],
"             \   'f': ['<Plug>(ale_fix)', 'fix'],
"             \   'r': ['<Plug>(ale_find_references)', 'references'],
"             \ })
" if filereadable(g:ale_matlab_mlint_executable)
"     let $PATH = fnamemodify(g:ale_matlab_mlint_executable, ':p:h') . ';' . $PATH
" endif
" " let g:loaded_ale = 0
" if !exists('g:loaded_ale')
"     try
"         packadd ale
" 	catch /.*/
"     endtry
" endif
" if exists('g:loaded_ale') && g:loaded_ale && exists(':ALEEnable')
" 	ALEEnable
"     set omnifunc=ale#completion#OmniFunc
" endif
" "}}}
" 
" " AsyncRun:{{{
" if !exists('g:asyncrun_status')
"     try
"         packadd asyncrun.vim
"     catch /.*/
"     endtry
" endif
" "}}}
" 
" " bufexplorer:" {{{
" if !exists('g:bufexplorer_version')
"     try
"         packadd bufexplorer
"     catch /.*/
"     endtry
" endif
" if exists('g:bufexplorer_version')
"     nnoremap <leader>B <esc>:<c-u>BufExplorer<cr>
" endif
" " }}}
" 
" " bufferline:" {{{
" if !exists('g:loaded_buffer')
"     try
"         packadd vim-bufferline
"     catch /.*/
"     endtry
" endif
" " }}}
" 
" "Coc.nvim{{{
" let g:loaded_coc = 0
" let g:coc_disable_startup_warning = 1
" "}}}
" 
" " ctrlp: " {{{
" if !exists('g:loaded_ctrlp')
"     try
"         packadd ctrlp.vim
"     catch /.*/
"     endtry
" endif
" " }}}
" 
" " EasyAlign: {{{
" if !exists("g:loaded_easy_align_plugin")
"     try
"         packadd vim-easy-align
"     catch /.*/
"     endtry
" endif
" if get(g:, 'loaded_easy_align_plugin', 0)
"     " EasyAlign
"     " Visual 模式下快捷键
"     xmap ga <Plug>(EasyAlign)
"     " Normal 模式下快捷键
"     nmap ga <Plug>(EasyAlign)
"     " 配置一些自定义符号
"     let g:easy_align_delimiters = {
"                 \ '>': { 'pattern': '>>\|=>\|>'  },
"                 \ '/': {
"                 \     'pattern':         '//\+\|/\*\|\*/',
"                 \     'delimiter_align': 'l',
"                 \     'ignore_groups':   ['!Comment'] },
"                 \ ']': {
"                 \     'pattern':       '[[\]]',
"                 \     'left_margin':   0,
"                 \     'right_margin':  0,
"                 \     'stick_to_left': 0
"                 \   },
"                 \ ')': {
"                 \     'pattern':       '[()]',
"                 \     'left_margin':   0,
"                 \     'right_margin':  0,
"                 \     'stick_to_left': 0
"                 \   },
"                 \ 'd': {
"                 \     'pattern':      ' \(\S\+\s*[;=]\)\@=',
"                 \     'left_margin':  0,
"                 \     'right_margin': 0
"                 \   }
"                 \ }
" endif
" " }}}
" 
" " easymotion:{{{
" if !exists('g:EasyMotion_loaded')
"     try
"         packadd vim-easymotion
"     catch /.*/
"     endtry
" endif
" if get(g:,'EasyMotion_loaded', 0)
"     nmap <m-f> <Plug>(easymotion-prefix)
" endif
" "}}}
" 
" " vim-startify: " {{{
" if !exists('g:loaded_startify')
" 	try
" 		packadd vim-startify
"     catch /.*/
" 	endtry
" endif
" let g:startify_bookmarks = [ {
" 			\ 	    'p': '~\vimfiles\plugin\packages.vim',
" 			\   }, 
" 			\	'~/.zshrc'
" 			\ ]
" let g:startify_commands = [
" 			\ ['PlugInstall', 'install plugins'],
" 			\ ':help reference',
" 			\ ['Vim Reference', 'h ref'],
" 			\ {'h': 'h ref'},
" 			\ ]
" let g:startify_disable_at_vimenter = 0
" if exists('g:loaded_startify')
"     nnoremap <leader>h :<C-u>Startify<CR>
" endif
" " }}}
" 
" " vim-airline:" {{{
" let g:airline_extensions = [
" 			\ 'ale', 
" 			\ 'branch', 
" 			\ 'bufferline', 
" 			\ 'coc', 
" 			\ 'ctrlp', 
" 			\ 'ctrlspace', 
" 			\ 'cursormode', 
" 			\ 'fzf', 
" 			\ 'keymap', 
" 			\ 'languageclient', 
" 			\ 'po', 
" 			\ 'poetv', 
" 			\ 'quickfix', 
" 			\ 'scrollbar', 
" 			\ 'searchcount', 
" 			\ 'tabline', 
" 			\ 'term', 
" 			\ 'vimcmake', 
" 			\ 'vimtex', 
" 			\ 'virtualenv', 
" 			\ 'whitespace', 
" 			\ 'wordcount', 
" 			\ 'zoomwintab', 
" 			\ ]
" " ALE
" let g:airline#extensions#disable_rtp_load = 1
" let g:airline#extensions#ale#enabled = 1
" let airline#extensions#ale#error_symbol = 'E:'
" let airline#extensions#ale#warning_symbol = 'W:'
" let airline#extensions#ale#show_line_numbers = 1
" let airline#extensions#ale#open_lnum_symbol = '(L'
" let airline#extensions#ale#close_lnum_symbol = ')'
" " Bookmarks
" let g:airline#extensions#bookmark#enabled = 1
" " Branch
" let g:airline#extensions#branch#enabled = 1
" let g:airline#extensions#branch#empty_message = ''
" let g:airline#extensions#branch#vcs_priority = ["git", "mercurial"]
" let g:airline#extensions#branch#use_vcscommand = 0
" let g:airline#extensions#branch#displayed_head_limit = 10
" " let g:airline#extensions#branch#format = 0
" let g:airline#extensions#branch#format = 1
" let g:airline#extensions#branch#sha1_len = 10
" let g:airline#extensions#branch#vcs_checks = ['untracked', 'dirty']
" let g:airline#extensions#bufferline#enabled = 1
" let g:airline#extensions#bufferline#overwrite_variables = 1
" " CasLock
" let g:airline#extensions#capslock#enabled = 1
" "Tabline
" let g:airline#extensions#tabline#enabled = 1
" let g:airline#extensions#tabline#show_splits = 1
" let g:airline#extensions#tabline#switch_buffers_and_tabs = 1
" let g:airline#extensions#tabline#show_buffers = 1
" let g:airline#extensions#tabline#show_tabs = 1
" let g:airline#extensions#tabline#show_tab_count = 2
" " let g:airline#extensions#tabline#exclude_preview = 1
" let g:airline#extensions#tabline#show_tab_nr = 1
" let g:airline#extensions#tabline#buf_label_first = 1
" let g:airline#extensions#tabline#buffers_label = 'Buffers'
" let g:airline#extensions#tabline#tabs_label = 'Tabs'
" let airline#extensions#tabline#current_first = 1
" if !exists('g:loaded_airline')
" 	try
" 		packadd vim-airline
" 		packadd vim-airline-themes
"     catch /.*/
" 	endtry
" endif
" if exists('g:loaded_airline')
" 	let g:airline#extensions#tabline#buffer_idx_mode = 1
" 	nmap <leader>1 <Plug>AirlineSelectTab1
" 	nmap <leader>2 <Plug>AirlineSelectTab2
" 	nmap <leader>3 <Plug>AirlineSelectTab3
" 	nmap <leader>4 <Plug>AirlineSelectTab4
" 	nmap <leader>5 <Plug>AirlineSelectTab5
" 	nmap <leader>6 <Plug>AirlineSelectTab6
" 	nmap <leader>7 <Plug>AirlineSelectTab7
" 	nmap <leader>8 <Plug>AirlineSelectTab8
" 	nmap <leader>9 <Plug>AirlineSelectTab9
" 	nmap <leader>0 <Plug>AirlineSelectTab0
" 	nmap <leader>- <Plug>AirlineSelectPrevTab
" 	nmap <leader>+ <Plug>AirlineSelectNextTab
" 	" call airline#init#bootstrap()
" 	" call airline#extensions#load()
" 	" AirlineTheme gruvbox
" endif
" " }}}
" 
" " vim-commentary:" {{{
" if !exists('g:loaded_commentary')
"     try
"         packadd vim-commentary
"     catch /.*/
"     endtry
" endif
" if exists('g:loaded_commentary')
"     nmap <M-;> <Plug>CommentaryLine
"     xmap <M-;> <Plug>Commentary
" endif
" " }}}
" 
" " gvimfullscreen:" {{{
" if has('gui_running') && has('libcall')
" 	let g:MyVimLib = globpath(&rtp, '/gvimfullscreen.dll.x64')
" 	function! ToggleFullScreen()
" 		call libcallnr(g:MyVimLib, "ToggleFullScreen", 0)
" 	endfunction
"     
" 	"Alt+Enter
" 	noremap <Plug>ToggleFullScreen <Esc>:call ToggleFullScreen()<CR>
" 	nmap <F11> <Plug>ToggleFullScreen
" 	nmap <A-Enter> <Plug>ToggleFullScreen
" 
" 	let g:VimAlpha = 240
" 	function! SetAlpha(alpha)
" 		let g:VimAlpha = g:VimAlpha + a:alpha
" 		if g:VimAlpha < 180
" 			let g:VimAlpha = 180
" 		endif
" 		if g:VimAlpha > 255
" 			let g:VimAlpha = 255
" 		endif
" 		call libcall(g:MyVimLib, 'SetAlpha', g:VimAlpha)
" 	endfunction
"     
" 	"Shift+Y
" 	nmap <s-y> <Esc>:call SetAlpha(3)<CR>
" 	"Shift+T
" 	nmap <s-t> <Esc>:call SetAlpha(-3)<CR>
" 
" 	let g:VimTopMost = 0
" 	function! SwitchVimTopMostMode()
" 		if g:VimTopMost == 0
" 			let g:VimTopMost = 1
" 		else
" 			let g:VimTopMost = 0
" 		endif
" 		call libcall(g:MyVimLib, 'EnableTopMost', g:VimTopMost)
" 	endfunction
"     
" 	"Shift+R
" 	nmap <s-r> <Esc>:call SwitchVimTopMostMode()<CR>
" endif
" 
" " }}}
" 
" 
" " im: {{{
" if has('multi_byte_ime')  
"     "未开启 IME 时光标背景色  
"     hi Cursor guifg=bg guibg=Orange gui=NONE  
"     "开启IME 时光标背景色  
"     hi CursorIM guifg=NONE guibg=Skyblue gui=NONE  
"     "关闭Vim的自动切换 IME 输入法(插入模式和检索模式)  
"     set iminsert=0 imsearch=0  
"     "插入模式输入法状态未被记录时，默认关闭IME  
"     inoremap <silent> <ESC> <ESC>:set iminsert=0<CR>  
" endif
" "}}}
" 
" " jupyter_vim" {{{
" let g:jupyter_highlight_cells = 1
" let g:jupyter_mapkeys = 1
" let g:jupyter_cell_separators = ['##', '#%%', '# %%', '# <codecell>']
" 
" " }}}
" 
" " Matlab {{{
" " python 2.7{{{
" let g:python27_executable = get(g:, 'python27_executable', [
" 			\ 'C:\Programs\Python\python2.7.16-x64\python.exe',
" 			\ 'C:\Programs\Python\2.7.16-x64\python.exe',
" 			\ ])
" " \ 'C:\Programs\Python\2.7.16-x86\python.exe',
" call filter(g:python27_executable, 'filereadable(v:val)')
" if !empty(g:python27_executable)
" 	let &pythonhome = fnamemodify(python27_executable[0], ':p:h')
" 	let $PATH = &pythonhome . ';' . $PATH
" 	" let &pythondll = 'python27.dll'
" 	if has('python')
" 		" echo &pythondll
" 		py import vim
" 	else
" 		echoerr 'python27 can not be loaded!' 
" 	endif
" endif
" "}}}
" let g:matvim_auto_connect=1
" let g:matvim_auto_start=0
" let g:matvim_max_outputchars = 1000
" try
"     packadd matvim
"     packadd vim-matlab
" catch /.*/
" endtry
" "}}}
" 
" " mru: " {{{
" if !exists('loaded_mru')
"     try
"         packadd mru.vim
"     catch /.*/
"     endtry
" endif
" " }}}
" 
" " MultiProject" {{{
" function! OpenProject(...) 
"     let path = g:MProjCurrentConfig.path
"     execute 'VimFiler ' . path
" endfunction
" let g:MProjAutoHide = 0
" let g:MProjProjectList = [
"             \   {
"             \       'name': 'vimfiles',
"             \       'path': expand('~/vimfiles'),
"             \       'open': function('OpenProject')
"             \   },
"             \   {
"             \       'name': 'EchoGeneration',
"             \       'path': expand('D:/SyncDisk/Projects/EchoGeneration'),
"             \       'open': function('OpenProject')
"             \   },
"             \   {
"             \       'name': 'AdaptiveIS',
"             \       'path': expand('D:/SyncDisk/Projects/AdaptiveIS'),
"             \       'open': function('OpenProject')
"             \   },
"             \ ]
" if !exists("g:loaded_mproj")
"     try
"         packadd MultiProject.vim
"     catch /.*/
"     endtry
" endif
" if exists("g:loaded_mproj")
"     map <leader>p <esc>:<c-u>MProjToggle<cr>
" endif
" " }}}
" 
" " Neomake:" {{{
" " let g:loaded_neomake = 0
" if !exists('g:loaded_neomake')
"     try
"         packadd neomake
"     catch /.*/
"     endtry
" endif
" let g:neomake_place_signs = 1
" let g:neomake_error_sign = {
"             \ 'text': '✖',
"             \ 'texthl': 'NeomakeErrorSign',
"             \ }
" let g:neomake_warning_sign = {
"             \   'text': '‼',
"             \   'texthl': 'NeomakeWarningSign',
"             \ }
" let g:neomake_message_sign = {
"             \   'text': '➤',
"             \   'texthl': 'NeomakeMessageSign',
"             \ }
" let g:neomake_info_sign = {
"             \ 'text': 'ℹ',
"             \ 'texthl': 'NeomakeInfoSign'
"             \ }
" let g:neomake_make_maker = {
"             \ 'exe': 'make',
"             \ 'args': [],
"             \ 'errorformat': '%f:%l:%c: %m',
"             \ }
" let g:neomake_tikz_maker = {
"             \ 'exe': 'pdflatex',
"             \ 'args': [ 'standalone.tex' ],
"             \ 'errorformat': '%f:%l:%c: %m',
"             \ }
" " " Use the maker like this:
" " :Neomake! make
" if exists('g:loaded_neomake')
"     " When writing a buffer.
"     call neomake#configure#automake('w')
"     " When writing a buffer, and on normal mode changes (after 750ms).
"     call neomake#configure#automake('nw', 750)
"     " When reading a buffer (after 1s), and when writing.
"     call neomake#configure#automake('rw', 1000)
" endif
" " }}}
" 
" " nerdtree" {{{
" if !exists('g:loaded_nerd_tree')
"     try
"         packadd nerdtree
"     catch /.*/
"     endtry
" endif
" if exists('g:loaded_nerd_tree')
"     nnoremap <Plug>NERDTreeToggle :<c-u>NERDTreeToggle<cr>
"     nmap <leader>t <Plug>NERDTreeToggle
" endif
" " }}}
" 
" " ProjectRoot:{{{
" if !exists('g:loaded_projectroot')
"     try
"         packadd vim-projectroot
"     catch /.*/
"     endtry
" endif
" if exists('g:loaded_projectroot') && g:loaded_projectroot
" 	nnoremap <m-.> :ProjectRootCD<cr>
" 	" Change current working directory
" 	" nnoremap <leader>dp :ProjectRootCD<cr>
" 	" Automatically whenever you open a buffer: 
" 	function! <SID>AutoProjectRootCD()
" 		try
"             if &ft != 'help'
"                 ProjectRootCD
"             endif
" 		catch
" 			" Silently ignore invalid buffers
" 		endtry
" 	endfunction
" 	autocmd BufEnter * call <SID>AutoProjectRootCD()
" 	" Edit a file relative to the project root~
" 	" By changing current directory: >
" 	nnoremap <leader>eq :ProjectRootCD<cr>:e<space>
" 	" Without changing the current directory: >
" 	nnoremap <expr> <leader>ep ':e '.projectroot#guess().'/'
" 	nnoremap <silent> [p :ProjectBufPrev<cr>
" 	nnoremap <silent> ]p :ProjectBufNext<cr>
" 	nnoremap <silent> [P :ProjectBufFirst<cr>
" 	nnoremap <silent> ]P :ProjectBufLast<cr>
" 	nnoremap <silent> ]v :ProjectBufNext ~/vimfiles<cr>
" 	nnoremap <silent> [v :ProjectBufPrev ~/vimfiles<cr>
" 	nnoremap <silent> ]f :ProjectBufNext 'F<cr>
" 	nnoremap <silent> [f :ProjectBufPrev 'F<cr>
" 	nnoremap <silent> <Leader>eg :ProjectRootExe grep<space>
" 	nnoremap <silent> <leader>ef :exe 'CtrlP' projectroot#guess("'F")<cr>
" 	nnoremap <silent> <leader>ep :exe 'CtrlP' projectroot#guess()<cr>
" endif
" "}}}
" 
" " slime{{{
" let g:slime_config_defaults = get(g:, 'slime_config_defaults', {})
" "}}}
" 
" " UltiSnips:" {{{
" let s:python3_candidates = [
"             \ 'C:\Programs\Python\3.6\python.exe',
"             \ 'C:\Programs\scoop\shims\python3.exe',
"             \   ]
" 
" let g:python3_executable_list = filter(s:python3_candidates, 'executable(v:val)' )
" if !has('python3') && len(g:python3_executable_list) > 0
"     let g:python3_executable = g:python3_executable_list[0]
"     let &pythonthreehome =  fnamemodify(g:python3_executable, ':p:h')
"     let &pythonthreedll =  fnamemodify(g:python3_executable . '\python3.dll', ':p:h')
" endif
" let g:UltiSnipsEditSplit = 'tabdo'
" let g:UltiSnipsSnippetDirectories = ['UltiSnips']
" let g:UltiSnipsSnippetStorageDirectoryForUltiSnipsEdit = '~\vimfiles\Ultisnips'
" let g:UltiSnipsEnableSnipMate = 1
" let g:UltiSnipsExpandTrigger = '<tab>'
" " let g:UltiSnipsListSnippets =  '<c-tab>'
" let g:UltiSnipsJumpForwardTrigger = '<c-j>'
" let g:UltiSnipsJumpBackwardTrigger = '<c-k>'
" let g:UltiSnipsExpandOrJumpTrigger = "<tab>"
" let g:leader_keymap.u = { 'name': '+UltiSnips',
"             \ 'a': ['UltiSnipsAddFileTypes', 'add filetype'],
"             \ 'e': ['UltiSnipsEdit', 'edit'],
"             \ }
" if !exists('did_plugin_ultisnips')
"     if has('python3')
"         try
"             packadd ultisnips
"         catch /.*/
"         endtry
"     endif
" endif
" if exists('did_plugin_ultisnips')
"     inoremap <c-x><c-k> <c-x><c-k>
" endif
" " }}}
" 
" " Unite:{{{
" let g:unite_source_outline_info = get(g:, 'unite_source_outline_info', {})
" let g:unite_source_outline_info.matlab = {
"             \	'heading': '^\s*\(classdef\|properties\|methods\|function\|end\s%\s\%(classdef\|properties\|methods\|function\)\)\s*\|^%%\s'
"             \ }
" if !exists('g:loaded_vimproc')
"     try
"         packadd vimproc
"     catch /.*/
"     endtry
" endif
" if !exists('g:loaded_unite')
"     try
"         packadd unite.vim
"         packadd unite-outline
"     catch /.*/
"     endtry
" endif
" if get(g:, 'loaded_unite', 0)
"     nnoremap <leader>u	:Unite -start-insert source<cr>
"     nnoremap <m-k>	:Unite -start-insert mapping<cr>
"     nnoremap <m-o>	:Unite outline<cr>
"     if get(g:, 'loaded_neomru', 0)
"         " packadd neomru.vim
"         nnoremap <m-r>	:Unite -start-insert file_mru directory_mru<cr>
"     endif
" endif
" "}}}
" 
" " VimTeX:{{{
" if !exists('g:loaded_vimtex')
"     try
"         packadd vimtex
"     catch /.*/
"     endtry
" endif
" if get(g:, 'loaded_vimtex', 0)
" 	let g:vimtex_enabled = v:true
" 	let g:tex_flavor='latex'
" 	let g:tex_conceal='abdmg'
" 	let g:vimtex_texcount_custom_arg=' -ch -total'
" 	let g:vimtex_delim_list = get(g:, 'vimtex#delim#lists', {})
" 	let g:vimtex_mappings_enabled = 1
" 	au FileType tex map <buffer> <silent>  <localleader>lw :VimtexCountWords!  <CR><CR>
" 	let g:Tex_ViewRule_pdf = 'SumatraPDF -reuse-instance -inverse-search "gvim - c \":RemoteOpen +\%l \%f\""'
" 	if executable('latexmk')
" 		let g:vimtex_compiler_latexmk_executable = exepath('latexmk')
" 	endif
" 	let g:vimtex_compiler_latexmk_executable = get(g:, 'vimtex_compiler_latexmk_executable', 'C:\Programs\texlive\2023\bin\windows\latexmk.exe')
" 	if !executable(g:vimtex_compiler_latexmk_executable)
" 		let $PATH='C:\Program Files\texlive\2023\bin\windows;'.$PATH
" 		if executable('latexmk')
" 			let g:vimtex_compiler_latexmk_executable = exepath('latexmk')
" 		else
" 			if executable('C:\\Program\ Files\\texlive\\2023\\bin\\windows\\latexmk.exe')
" 				let g:vimtex_compiler_latexmk_executable = executable('latexmk') ? exepath('latexmk') : 'C:\\Program\ Files\\texlive\\2023\\bin\\windows\\latexmk.exe'
" 			endif
" 		endif
" 	endif
" 	let g:vimtex_view_general_viewer = get(g:, 'vimtex_view_general_viewer', 'SumatraPDF')
" 	if !executable(g:vimtex_view_general_viewer)
" 		let $PATH='C:\Program Files\SumatraPDF;'.$PATH
" 		let g:vimtex_view_general_viewer = executable('SumatraPDF') ? exepath('SumatraPDF') : fnameescape("C:\\Program Files\\SumatraPDF\\SumatraPDF.exe")
" 	endif
" 
" 	" latexrun
" 	if executable('latexrun')
" 		let g:vimtex_compiler_method = 'latexrun'
" 		let g:vimtex_compiler_latexrun_engines = {
" 					\ '_'                : 'pdflatex',
" 					\ 'pdflatex'         : 'pdflatex',
" 					\ 'lualatex'         : 'lualatex',
" 					\ 'xelatex'          : 'xelatex',
" 					\}
" 	endif
" 	" latexmk
" 	if executable('latexmk') || executable(g:vimtex_compiler_latexmk_executable)
" 		let g:vimtex_compiler_method = 'latexmk'
" 		let g:vimtex_compiler_latexmk = {
" 					\ 'aux_dir' : '',
" 					\ 'out_dir' : '',
" 					\ 'build_dir': 'pdf',
" 					\ 'callback': 1,
" 					\ 'continous': 1,
" 					\ 'executable': g:vimtex_compiler_latexmk_executable,
" 					\ 'hooks' : [],
" 					\ 'options' : [
" 					\   '-verbose',
" 					\   '-file-line-error',
" 					\   '-synctex=1',
" 					\   '-interaction=nonstopmode',
" 					\ ] ,
" 					\}
" 		let g:vimtex_compiler_latexmk_engines = {
" 					\ '_'                : '-pdf',
" 					\ 'pdflatex'         : '-pdf',
" 					\ 'dvipdfex'         : '-pdfdvi',
" 					\ 'lualatex'         : '-lualatex',
" 					\ 'xelatex'          : '-xelatex',
" 					\ 'context (pdftex)' : '-pdf -pdflatex=texexec',
" 					\ 'context (luatex)' : '-pdf -pdflatex=context',
" 					\ 'context (xetex)'  : "-pdf -pdflatex='texexec --xtx'",
" 					\}
" 	endif
" 	" viewer
" 	let g:vimtex_view_method='general'
" 	if executable('SumatraPDF')
" 		let g:vimtex_view_general_viewer = 'SumatraPDF'
" 	else
" 		let g:vimtex_view_general_viewer = 'C:\Programs\SumatraPDF\SumatraPDF.exe'
" 	endif
" 	" let g:vimtex_view_general_options_latexmk = '-reuse-instance'
" 	let g:vimtex_view_general_options
" 				\ = ' -reuse-instance -forward-search @tex @line @pdf'
" 				\ . ' -inverse-search "' . 'cmd /c start /min \"\" ' . exepath(v:progpath)
" 				\ . ' -v --not-a-term -T dumb -c \"VimtexInverseSearch %l ''%f''\""' 
" 	let g:vimtex_quickfix_open_on_warning=0
" 	let g:vimtex_quickfix_mode=1
" endif
" "}}}
" 
" " VimWiki:{{{
" let g:vimwiki_ext2syntax = {
"             \   '.wiki': 'media'
"             \ }
"             " \   '.md': 'markdown',
"             " \   '.mkd': 'markdown',
" let g:vimwiki_filetypes = ['wiki']
" let g:vimwiki_global_ext = 1
" let g:leader_keymap.w = { 'name': '+vimwiki', 
"             \	'b': ['<Plug>Vimwiki2HTMLBrowse', 'browse'],
"             \	'i': ['<Plug>VimwikiIndex', 'index'],
"             \   'I': ['<Plug>VimwikiTabIndex', 'index-tab'],
"             \   's': ['<Plug>VimwikiUISelect', 'select'],
"             \	'f': ['<Plug>VimwikiFollowLink', 'follow'],
"             \	'S': ['<Plug>VimwikiSplitLink', 'split'],
"             \	'h': ['<Plug>Vimwiki2HTML', 'html'],
"             \	'g': ['<Plug>VimwikiDiaryGenerateLinks', 'generate'],
"             \	'd': ['<Plug>VimwikiDiaryIndex', 'diary'],
"             \	'n': ['<Plug>VimwikiMakeDiaryNote', 'note'],
"             \	'N': ['<Plug>VimwikiTabMakeDiaryNote', 'note'],
"             \	'y': ['<Plug>VimwikiMakeYesterdayDiaryNote', 'yesterday'],
"             \	'm': ['<Plug>VimwikiMakeTomorrowDiaryNote', 'tommorrow'],
"             \ }
" if !exists("g:loaded_vimwiki")
"     try
"         packadd vimwiki
"     catch /.*/
"     endtry
" endif
" if exists("g:vimwiki_wikilocal_vars")
"     let wiki = g:vimwiki_wikilocal_vars[0]
"     let wiki.path = expand('~\VimWiki\')
"     let g:vimwiki_wikilocal_vars[0] = wiki
"     let g:vimwiki_list = [wiki]
" endif
" if exists("g:loaded_vimwiki")
"     " global mapping
"     nmap <Leader>ww 			<Plug>VimwikiIndex
"     nmap <Leader>wt 			<Plug>VimwikiTabIndex
"     nmap <Leader>ws 			<Plug>VimwikiUISelect
"     nmap <Leader>wi 			<Plug>VimwikiDiaryIndex
"     nmap <Leader>w<Leader>w 	<Plug>VimwikiMakeDiaryNote
"     nmap <Leader>w<Leader>t 	<Plug>VimwikiTabMakeDiaryNote
"     nmap <Leader>w<Leader>y 	<Plug>VimwikiMakeYesterdayDiaryNote
"     nmap <Leader>w<Leader>m 	<Plug>VimwikiMakeTomorrowDiaryNote
"     " local mapping
"     nmap <Leader>wh         	<Plug>Vimwiki2HTML
"     nmap <Leader>whh         	<Plug>Vimwiki2HTMLBrowse
" 
"     nmap <M-BS> <Plug>VimwikiGoBackLink
" 
" 	function! VimwikiLinkHandler(link)
" 		try
" 			let link = a:link
" 			if link =~# 'https\?://'
" 				if executable('C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')
" 					let browser = exepath('C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe')
" 					silent execute '!start "'.browser.'" ' . a:link
" 					return 1
" 				endif
" 			endif
" 			let pwd = fnamemodify(bufname('%'), ':p:h')
" 			let filename = expand(pwd . '/' . link)
" 			if filename !~# '.*\.wiki'
" 				let filename = filename . '.wiki'
" 			endif
" 			execute 'edit ' . filename
" 			return 1
" 		catch
" 			echoerr v:exception
" 		endtry
" 		return 0
" 	endfunction
" endif
" "}}}
" 
" " YCM {{{
" let g:loaded_ycm = 0
" " 8.2.3995+
" if v:versionlong >= 8023995
"     let g:ycm_autoclose_preview_window_after_completion=1
"     let g:maplocalleader = get(g:, 'maplocalleader', '\')
"     if !exists('g:loaded_ycm') 
"         try
"             packadd YouCompleteMe
"         catch /.*/
"         endtry
"     endif
"     if exists('g:loaded_ycm') && g:loaded_ycm
"         map <localleader>g  :YcmCompleter GoToDefinitionElseDeclaration<CR>
"     endif
" endif
" "}}}
" 
" let g:gutentags_ctags_executable='ctags.exe'
